<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>

<form name="form1" id="form1" action="" method="post">
<input type="hidden" id="id" name="id" value="${adminUser.id}" />
	<div class="pageMain">
		<div class="pageTitle"><%=MessageResourcesUtils.getMessage(request, "systemmanage.storemanagement.title") %><span></span><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storeuser.title") %><span></span><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storeuser.userupdate.title") %></div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.store.column.number") %></label>
						<span>
							<input type="text" id="storecode" name="storecode" value="${store.number}" class="validate[required]"/>
							<input type="hidden" id="storeid" name="storeid" value="${adminUser.storeid}">
						</span>
					</li>
					<li>
						<i>&nbsp;&nbsp;</i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.store.column.name") %></label>
						<span><input type="text" id="storename" name="storename" value="${store.name}" readonly="readonly" /></span>
					</li>
				</ul>
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.userloginname") %></label>
						<span>${adminUser.loginname}</span>
					</li>
				</ul>
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.validstart") %></label>
						<span><input type="text" class="validate[required,custom[date]]" id="validstart" name="validstart" value="" /></span>
					</li>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.validend") %></label>
						<span><input type="text" class="validate[required,custom[date]]" id="validend" name="validend" value="" /></span>
					</li>
				</ul>
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.certsn") %></label>
						<span><input type="text" id="certsn" name="certsn" maxlength="50" size="22" class="validate[]" value="${adminUser.certsn}"/></span>
					</li>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.certcn") %></label>
						<span><input type="text" id="certcn" name="certcn" maxlength="50" size="22" class="validate[]" value="${adminUser.certcn}"/></span>
					</li>
				</ul>
			</div>			
        	<div class="button-group">
       			<input type="hidden"  name="updateposition" id="updateposition" value="0"/>
       			<input type="button" class="btn btn-default"  id="butSave" name="butSave" value='<%=MessageResourcesUtils.getMessage(request, "common.button.save") %>' />
       			<input type="button" class="btn btn-default"  id="butReturn" name="butReturn" value='<%=MessageResourcesUtils.getMessage(request, "common.button.back") %>' />
			</div>
		</div>
	</div>
</form>

<script type="text/javascript">	
$(document).ready(function() {
	$('#validstart').date_input();
	$('#validend').date_input();
	$('#validstart').val('${validstart}');
	$('#validend').val('${validend}');
	
	$("#storecode").issNewMagnifier({
		title: '<%=MessageResourcesUtils.getMessage(request, "systemmanage.databasebinding.storemagnifiertitle") %>',
		url: '${systemctx}/publicMagnifier/publicMagnifier.json',
		sortName : 'modifytime',
		sortOrder : 'desc',
		linkName: 'number',
		callSqlKey: 'queryStoreMagnifierSql',
		changeIgnore: ['storecode'],
		columns: [[
				{title:'<%=MessageResourcesUtils.getMessage(request, "dailyoperation.store.column.number") %>', field:'number', width:220, sortable:true, align: 'left', formel:'storecode'},
				{title:'<%=MessageResourcesUtils.getMessage(request, "dailyoperation.store.column.name") %>', field:'name', width:300, sortable:true, align: 'left', formel:'storename'},
		       	{field:'id', hidden:true, formel:'storeid'}
		]],
		onBeforeOpen:function(p){
	      var queryParams = {
	    		  querystore: '%' + $("#storecode").val() + '%',
	    		  statusid: <%=SysConstant.RecordStatus.VALID %>,
	    		  state : <%=SysConstant.CommonApproveStatus.OK %>
	      };
	      return queryParams;
	    }
	});
	
	$('#butSave').click(function() {
			//获得所属省名称
			var exp = $('#form1').validationEngine('validate');
			var validstart = $('#validstart').val();
			var validend = $('#validend').val();
			validstart = validstart.replace(/\-/gi,"/");
			validend = validend.replace(/\-/gi,"/");
			var time1 = new Date(validstart).getTime();
			var time2 = new Date(validend).getTime();
			if(time1>=time2){
				alert("<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.date") %>");
				return;
			}
			if(exp==true)
			{
				if($("#storeid").val() == '')
				{
					alert("<%=MessageResourcesUtils.getMessage(request, "systemmanage.user.storenotnull") %>");
					return;
				}
				// 显示进度条
				showSending();
				form1.action="${systemctx}/dailyoperation/storeuser/updateAdminUser.web";
				form1.submit();
			}
	});
	
	$('#butReturn').click(function(){
		parent.document.location.reload();
	    $.fn.closeIssWindow();
	});
	
});
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>